// 霍夫曼树的相关算法
#include "./model/huffman-tree-static.h"

int main()
{
	char data[] = {'a', 'b', 'c', 'd', 'e', 'f'};
	int weight[] = {27, 8, 15, 15, 30, 5};
	HuffmanTree *tree = createHuffmanTree(data, weight, sizeof(weight) / sizeof(int));
	preorderTraverse(tree, tree->root);
	printf("\n");
	inorderTraverse(tree, tree->root);
	printf("\n");
	printf("WPL:%d\n", getWPL(tree));
	CodeMap *map = huffmanCoding(tree);
	for (int i = 0; i < map->count; i++)
	{
		printf("%c:%s \n", map->codeResults[i].data, map->codeResults[i].code);
	}
	return 0;
}